package patrol.mobile.com.mobilepatrol.activity.monitor;

import android.content.Intent;
import android.support.annotation.NonNull;

import java.util.List;

import patrol.mobile.com.mobilepatrol.R;
import patrol.mobile.com.mobilepatrol.activity.CommonHomeActivity;
import patrol.mobile.com.mobilepatrol.activity.office.ExaminationAllActivity;
import patrol.mobile.com.mobilepatrol.activity.office.HomeDataHelper;
import patrol.mobile.com.mobilepatrol.activity.office.OtherBusinessActivity;
import patrol.mobile.com.mobilepatrol.activity.office.OtherBusinessSearchActivity;
import patrol.mobile.com.mobilepatrol.activity.toll.AppealListActivity;
import patrol.mobile.com.mobilepatrol.activity.toll.JobEvaluationActivity;
import patrol.mobile.com.mobilepatrol.activity.toll.MyEvaluationActivity;
import patrol.mobile.com.mobilepatrol.adapter.MyHomeAdapter;
import patrol.mobile.com.mobilepatrol.bean.HomeDataBean;
import patrol.mobile.com.mobilepatrol.bean.MenuBean;
import patrol.mobile.com.mobilepatrol.bean.MenuConstants;
import patrol.mobile.com.mobilepatrol.manager.UserManager;
import patrol.mobile.com.mobilepatrol.utils.Constants;
import patrol.mobile.com.mobilepatrol.utils.SPUtils;

/**
 * Created by admin on 2018/9/11.
 * Desc:监控管理主页
 */

public class MonitorManagerHomeActivity extends CommonHomeActivity {
//    private static final String[] stringsTop = new String[]{"综合查询", "日常管理", "其他业务"};
//    //    private static final String[] stringsSub1 = new String[]{"机电设备台账", "绩效考核汇总", "申诉处理", "机电故障汇总", "机电巡检汇总", "其他业务查询"};
//    private static final String[] stringsSub1 = new String[]{"机电设备台账", "绩效考核汇总",  "机电故障汇总", "机电巡检汇总", "其他业务查询"};
//    private static final String[] stringsSub2 = new String[]{"岗位考核", "我的考核", "机电巡检", "故障报修", "机电修复", "申诉处理"};
//    private static final String[] stringsSub3 = new String[]{"其他业务"};
    //    private static final int[] img1 = new int[]{R.mipmap.equipment_file, R.mipmap.assess_pool, R.mipmap.complaint_andling, R.mipmap.fault_pool, R.mipmap.mechatronics_ins_sum, R.mipmap.other_queries};
//    private static final int[] img1 = new int[]{R.mipmap.equipment_file, R.mipmap.assess_pool, R.mipmap.fault_pool, R.mipmap.mechatronics_ins_sum, R.mipmap.other_queries};
//    private static final int[] img2 = new int[]{R.mipmap.post_assessment, R.mipmap.my_assessment, R.mipmap.mechatronic_inspection, R.mipmap.failure_reporting, R.mipmap.mechanical_electrical_repair, R.mipmap.complaint_andling};
//    private static final int[] img3 = new int[]{R.mipmap.other};
private List<MenuBean> menuBeanList;

    @NonNull
    @Override
    protected String initTitleName() {
        return "监控管理";
    }

    @NonNull
    @Override
    protected List<HomeDataBean> initAdapterData() {
        menuBeanList= (List<MenuBean>) getIntent().getSerializableExtra(MenuConstants.MENU_DATA);
        return HomeDataHelper.getInstance().getHomeData(
                MenuConstants.JKGL_TOP_TITLES,
                MenuConstants.JKGL_CHILD_TITLES_1,
                MenuConstants.JKGL_CHILD_TITLES_2,
                MenuConstants.JKGL_CHILD_IMGS_1,
                MenuConstants.JKGL_CHILD_IMGS_2,menuBeanList);
    }

    @Override
    public void setListener() {
        super.setListener();
        mAdapter.setItemClickListener(new MyHomeAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(int parentPosition, int childPosition) {
                switch (parentPosition) {
                    case 0:
                        switch (childPosition) {
                            case 0:
                                startActivity(EquipmentArchivesActivity.class);
                                break;
                            case 1:
//                                startActivity(JiXiaoHuiZongActivity.class);//考核汇总
                                startActivity(ExaminationAllActivity.class);//岗位考核汇总
                                break;
                            case 2:
                                startActivity(ElectricalAndMechanicalFailureActivity.class);
                                break;
                            case 3:
                                startActivity(MechanicalAndElectricalInspectionActivity.class);
                                break;
                            case 4:
                                startActivity(OtherBusinessSearchActivity.class);//其它业务查询
                                break;
                        }
                        break;
                    case 1:
                        switch (childPosition) {
                            case 0:
                                startActivity(JobEvaluationActivity.class);//岗位考评
                                break;
                            case 1:
                                startActivity(MyEvaluationActivity.class);//我的考核
                                break;
                            case 2:
                                startActivity(new Intent(MonitorManagerHomeActivity.this, JdsbxjwhActivity.class)
                                        .putExtra("isShowAddIcon", true)
                                        .putExtra("orgId", UserManager.getUser((String) SPUtils.get(Constants.current_id, "")).bmcode)
                                );
                                break;
                            case 4:
                                startActivity(JdxgActivity.class);
                                break;
                            case 3:
                                startActivity(GzbxActivity.class);
                                break;
                            case 5:
                                startActivity(AppealListActivity.class);//申诉处理
                                break;
                        }
                        break;
                    case 2:
                        startActivity(OtherBusinessActivity.class);//其它业务
                        break;
                }
            }
        });
    }
}
